package com.choudou5.solr.framework.holder;

import com.choudou5.solr.util.ConfigUtil;
import com.choudou5.solr.util.IpUtil;

import javax.servlet.ServletContext;

/**
 * @name 系统上下文
 * @author choudou5
 * @date：2018-07-27
 */
public class SysContextHolder {

    private static ServletContext CONTEXT = null;
    private static String SERVICE_HOST = IpUtil.getLocalHostIP() +":"+ ConfigUtil.getStr("sys.port");

    public static void initContext(ServletContext context) {
        CONTEXT = context;
    }

    public static String getServiceHost(){
        return SERVICE_HOST;
    }

    public static void setParam(String name, Object value) {
        CONTEXT.setAttribute(name, value);
    }

}
